
    using SmartSoft.DAL;
    using System.Web.Services;
    using System;
    using System.Data;
    using System.Data.SqlClient;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WSDmPBSPDataAccess : System.Web.Services.WebService
{
    private DmPBSPDataAccess objDataAccess = new DmPBSPDataAccess();
    public WSDmPBSPDataAccess()
    {
    }


    [WebMethod]
    public void CreateInvoice(string ps_Subsidiary, object pd_Ngay_Ct, object ps_Dien_Giai, object ps_Desc_EN, object ps_Ma_Tte, object ps_UserName, object pi_Posted, object pb_Locked, DataTable poDetail)
{
object[] arr = Validator.Validate(pd_Ngay_Ct, ps_Dien_Giai, ps_Desc_EN, ps_Ma_Tte, ps_UserName, pi_Posted, pb_Locked);
objDataAccess.CreateInvoice(ps_Subsidiary, arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], poDetail);
}



    [WebMethod]
    public DataSet GetDataSet(string ps_Subsidiary, object ps_Loai_PB)
    {
        object[] arr = Validator.Validate(ps_Loai_PB);
        return objDataAccess.GetDataSet(ps_Subsidiary, arr[0]);
    }

    [WebMethod]
    public DataSet GetDataSetC(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2);
        return objDataAccess.GetDataSetC(ps_Subsidiary, arr[0], arr[1]);
    }

    [WebMethod]
    public DataTable GetDetailTable(object ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Sp)
    {
        object[] arr = Validator.Validate(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Sp);
        return objDataAccess.GetDetailTable(arr[0], arr[1], arr[2], arr[3]);
    }

    [WebMethod]
    public DataTable GetDetailTableC(object ps_KeyCode)
    {
        object[] arr = Validator.Validate(ps_KeyCode);
        return objDataAccess.GetDetailTableC(arr[0]);
    }

    [WebMethod]
    public DataTable GetDetailTableHS(object ps_KeyCode)
    {
        object[] arr = Validator.Validate(ps_KeyCode);
        return objDataAccess.GetDetailTableHS(arr[0]);
    }

    [WebMethod]
    public DataTable GetMasterTable(object ps_Subsidiaries, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Sp_Me)
    {
        object[] arr = Validator.Validate(ps_Subsidiaries, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Sp_Me);
        return objDataAccess.GetMasterTable(arr[0], arr[1], arr[2], arr[3]);
    }

    [WebMethod]
    public DataTable PhanBo_CHSP(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Sp_Me, object ps_Ma_Yt, ref object pi_TTien)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Sp_Me, ps_Ma_Yt, pi_TTien);
        return objDataAccess.PhanBo_CHSP(ps_Subsidiary, arr[0], arr[1], arr[2], arr[3], ref pi_TTien);
    }

    [WebMethod]
    public void PhanBo_Delete_All(object ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Sp_Me)
    {
        object[] arr = Validator.Validate(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Sp_Me);
        objDataAccess.PhanBo_Delete_All(arr[0], arr[1], arr[2], arr[3]);
    }

    [WebMethod]
    public int PhanBo_DMSP(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object pi_ZPBID, object ps_Tk_154, object ps_UserName)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2, pi_ZPBID, ps_Tk_154, ps_UserName);
        return objDataAccess.PhanBo_DMSP(ps_Subsidiary, arr[0], arr[1], arr[2], arr[3], arr[4]);
    }

    [WebMethod]
    public int PhanBo_HSSP(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object pi_ZPBID, object ps_Tk_154, object ps_UserName)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2, pi_ZPBID, ps_Tk_154, ps_UserName);
        return objDataAccess.PhanBo_HSSP(ps_Subsidiary, arr[0], arr[1], arr[2], arr[3], arr[4]);
    }

    [WebMethod]
    public int PhanBo_TLSP(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object pi_ZPBID, object ps_Tk_154, object ps_UserName)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2, pi_ZPBID, ps_Tk_154, ps_UserName);
        return objDataAccess.PhanBo_TLSP(ps_Subsidiary, arr[0], arr[1], arr[2], arr[3], arr[4]);
    }

    [WebMethod]
    public int PhanBo_TTSP(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object pi_ZPBID, object ps_Tk_154, object ps_UserName)
    {
        object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2, pi_ZPBID, ps_Tk_154, ps_UserName);
        return objDataAccess.PhanBo_TTSP(ps_Subsidiary, arr[0], arr[1], arr[2], arr[3], arr[4]);
    }

    [WebMethod]
    public void ReAllocation(object ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Sp, object ps_Ma_Yt, object pi_Tien)
    {
        object[] arr = Validator.Validate(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Sp, ps_Ma_Yt, pi_Tien);
        objDataAccess.ReAllocation(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]);
    }



    [WebMethod]
    public int SaveRow(bool pb_NewChecked, DataTable tableRow)
    {

        return objDataAccess.SaveRow(pb_NewChecked, tableRow.Rows[0]);
    }

    [WebMethod]
    public bool SaveRowC(bool pb_NewChecked, object pd_Ngay_Ct1, object pd_Ngay_Ct2, DataTable po_MasterDataRow, DataTable po_DetailDataTable)
{
object[] arr = Validator.Validate(pd_Ngay_Ct1, pd_Ngay_Ct2);
return objDataAccess.SaveRowC(pb_NewChecked, arr[0], arr[1], po_MasterDataRow.Rows[0], po_DetailDataTable);
}

    [WebMethod]
    public bool SaveRowHS(bool pb_NewChecked, DataTable po_MasterDataRow, DataTable po_DetailDataTable)
    {

        return objDataAccess.SaveRowHS(pb_NewChecked, po_MasterDataRow.Rows[0], po_DetailDataTable);
    }

    [WebMethod]
    public int UpdateProductCosting(object ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Sp_Me, object ps_Tk_154)
    {
        object[] arr = Validator.Validate(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Sp_Me, ps_Tk_154);
        return objDataAccess.UpdateProductCosting(arr[0], arr[1], arr[2], arr[3], arr[4]);
    }
}
